HAL RTC wake-up functions migration

This section provides information about the HAL RTC wake-up functions migration.

Note

The RTC handle is removed in HAL2, so for the following RTC HAL2 functions, the handle will be removed from the parameters.

Related concept: Other HAL RTC changes

HAL RTC set wake up timer

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc,
                                           uint32_t WakeUpCounter,
                                           uint32_t WakeUpClock)
hal_status_t HAL_RTC_WAKEUP_SetConfig(const hal_rtc_wakeup_config_t *p_config_wakeup_timer)
hal_status_t HAL_RTC_WAKEUP_SetPeriod(const hal_rtc_time_t *p_auto_reload_time,
                                      const hal_rtc_time_t *p_auto_clear_time);
hal_status_t HAL_RTC_WAKEUP_Start(uint32_t interruption)

HAL RTC set wake up timer IT

In HAL2, there is no dedicated function for enabling wake-up interrupts.

Instead, you need to follow the same sequence and enable the interrupt by passing it as an argument to the start function using HAL_RTC_WAKEUP_IT_ENABLE.

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc,
                                              uint32_t WakeUpCounter,
                                              uint32_t WakeUpClock,
                                              uint32_t WakeUpAutoClr)
hal_status_t HAL_RTC_WAKEUP_SetConfig(const hal_rtc_wakeup_config_t *p_config_wakeup_timer)
hal_status_t HAL_RTC_WAKEUP_SetPeriod(const hal_rtc_time_t *p_auto_reload_time,
                                      const hal_rtc_time_t *p_auto_clear_time);
hal_status_t HAL_RTC_WAKEUP_Start(uint32_t interruption)

HAL RTC deactivate wake up timer

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_WAKEUP_Stop(void)

HAL RTC get wake up timer

HAL1

HAL2

uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
uint32_t HAL_RTC_WAKEUP_GetAutoReload(void)

HAL RTC wake up timer IRQ handler

HAL1

HAL2

void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
void HAL_RTC_WAKEUP_IRQHandler(void)

HAL RTC wake up timer event callback

HAL1

HAL2

void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
void HAL_RTC_WakeUpTimerEventCallback(void)

HAL RTC poll for wake up timer event

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc,
                                                    uint32_t Timeout)
hal_status_t HAL_RTC_WAKEUP_PollForEvent(uint32_t timeout_ms)